package migrations

import (
	"github.com/goravel/framework/contracts/database/schema"
	"github.com/goravel/framework/facades"
)

type M20250224131211CreateAttachmentCategoryTables struct {
}

// Signature The unique signature for the migration.
func (r *M20250224131211CreateAttachmentCategoryTables) Signature() string {
	return "20250224131211_create_attachment_categories_tables"
}

// Up Run the migrations.
func (r *M20250224131211CreateAttachmentCategoryTables) Up() error {
	if !facades.Schema().HasTable("attachment_categories") {
		return facades.Schema().Create("attachment_categories", func(table schema.Blueprint) {
			table.ID()
			table.UnsignedBigInteger("pid").Nullable()
			table.String("name")
			table.String("dir")
			table.Timestamps()
			table.SoftDeletes("deleted_at")
		})
	}

	return nil
}

// Down Reverse the migrations.
func (r *M20250224131211CreateAttachmentCategoryTables) Down() error {
	return facades.Schema().DropIfExists("attachment_category_tables")
}
